package com.my.study.designPatterns.compoundPattern;

public class DuckSimulator3 {

    public static void main(String[] args) {

        DuckSimulator3 duckSimulator3 = new DuckSimulator3();
        duckSimulator3.simulate();

    }

    public void simulate(){
        Quackable green = new GreenHeadDuck();
        Quackable red = new RedHeadDuck();
        Quackable yellow = new YellowHeadDuck();

        QuackCounter quackCounter = new QuackCounter(green);
        QuackCounter quackCounter1 = new QuackCounter(red);
        QuackCounter quackCounter2 = new QuackCounter(yellow);

        Quackable goose = new GooseAdapter(new Goose());

        System.out.println("------DuckSimulatorOnePattern---------");
        makeQuack(quackCounter);
        makeQuack(quackCounter1);
        makeQuack(quackCounter2);
        makeQuack(goose);

        System.out.println("number of quack duck :" + QuackCounter.numberOfQuack);

    }


    public void makeQuack(Quackable quackable){

        quackable.quack();
    }

}
